Search Database SQL / Scripts


  Help us in improving the repository. Add new Queries/Scripts through 'Submit Database SQL / Scripts ' link.





Database SQL / Scripts for '#With as' - 4 Query/Script(s) found

 Sample 1. Add New Date Column with Comment

ALTER TABLE_NAME
ADD COLUMN_NAME DATE;
COMMENT ON COLUMN TABLE_NAME.COLUMN_NAME IS 'Date Column for xyz';

   Like      Feedback     Add Column with comment  Add a Column with comment  Add Column  Alter  Comment  COMMENT ON COLUMN


 Sample 2. Oracle - Create Table with Primary Key, Not Null and Foreign Key Constraints

CREATE TABLE TABLE_NAME (
ID NUMBER CONSTRAINT ID_KEY PRIMARY KEY,
NAME VARCHAR(50) CONSTRAINT NAME_NOT_NULL NOT NULL,
CONSTRAINT NAME_FK FOREIGN KEY (NAME) REFERENCES OTHER_TABLE_NAME (NAME)
);

   Like      Feedback     create table  create table with foreign key


 Sample 3. Cursor to get Ids from one table and then insert records into another ( Get Employee Ids from EMPLOYEE Table and insert records within EMPLOYEE_SALARY with default salary of 1000 )

DECLARE
   cursor employeeIds IS
      select * from EMPLOYEE;

   BEGIN
      FOR rec IN employeeIds LOOP
         INSERT INTO EMPLOYEE_SALARY(ID, SALARY) VALUES(rec.ID, 1000);
      END LOOP;
END;

   Like      Feedback     cursor


 Sample 4. SQL With Clause

with employee_dept_marketing as (

select * from EMPLOYEE

join DEPT on EMP_DEPT_ID = DEPT_ID

where DEPT_NAME = 'Marketing'

)

select PROFILE_NAME from PROFILE p

join employee_dept_marketing on PROFILE_ID = p.ID

where p.REQUIRED_EXPERIENCE > 10;

   Like      Feedback     sql with clause  with as



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner